package com.example.nlp_clusteringproject.controller;

import com.example.nlp_clusteringproject.model.enums.ResultCodeEnum;
import com.example.nlp_clusteringproject.util.NLP_ClusteringProject;
import com.example.nlp_clusteringproject.util.result.Result;
import com.example.nlp_clusteringproject.util.result.ResultGenerator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class PreProcessController {

    @RequestMapping("/preProcess")
    public Result<String> preProcess(String filePath, Integer categoryNumber, Integer fileNumber, Boolean dimensionReduction) {
        if (categoryNumber == null || fileNumber == null) {
            return ResultGenerator.genFreeResult(ResultCodeEnum.PARAM_IS_NULL, null);
        }

        return ResultGenerator.genSuccessResult(NLP_ClusteringProject.nlp(filePath, categoryNumber, fileNumber, dimensionReduction));
    }
}
